<template>
  <div class="company-library-box">
    <div class="banner-box">
      <div class="page-title">企业库</div>
    </div>
    <div class="content-box">
      <div
        class="item-box"
        :span="6"
        v-for="(item, index) of list"
        :key="index"
      >
        <div class="top">
          <div
            class="item-img"
            :style="{ backgroundImage: 'url(' + item.coverUrl + ')' }"
          ></div>
          <div class="item-title">{{ item.name }}</div>
          <div class="item-tags">
            <span class="tag" v-for="item in item.tags" :key="item.uuid">{{
              item.name
            }}</span>
          </div>
          <!-- <div class="item-subtitle">{{item.summary}}</div> -->
          <!-- </div> -->
          <div class="bottom">
            <div class="text" :title="item.desc">
              {{ item.desc }}
            </div>
          </div>
        </div>
      </div>
      <!-- </el-row> -->
    </div>
    <!-- <div class="more-btn" v-if="list.length < maxPage" @click="loadMore">加载更多内容…</div>
    <div class="nodata" v-if="list.length === maxPage">到底了...</div> -->
    <div class="pagination">
      <el-pagination
        background
        :page-size="20"
        @current-change="getActivityList"
        :current-page.sync="currentPage"
        layout="prev, pager, next"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { articlesList, advertsList } from "@/api/api";
export default {
  data() {
    return {
      currentPage: 1,
      start: 0,
      maxPage: 0,
      list: [],
      total: 0,
    };
  },
  mounted() {
    this.getTopBanner();
    this.getActivityList();
  },
  methods: {
    // 加载更多
    loadMore() {
      this.getZXList();
    },
    // 获取活动列表
    async getActivityList() {
      const params = {
        status: 1,
        type: "QY",
        start: (this.currentPage - 1) * 20,
        limit: 20,
      };
      const res = await articlesList(params);
      this.total = res.count;
      this.list = res.list;
    },
    // 获取top banner
    async getTopBanner() {
      const params = {
        type: "TOP",
        pageType: "QY_PAGE",
        status: 1,
      };
      const res = await advertsList(params);
      console.log(res.list, "企业banner");
    },
  },
};
</script>

<style lang="scss" scoped>
.company-library-box {
  background: #f1f1f1;
  padding-bottom: 50px;
  .banner-box {
    width: 100%;
    height: 600px;
    background: url("../../assets/company-banner.png") no-repeat;
    background-size: cover;
    .page-title {
      font-size: 72px;
      font-family: Helvetica;
      color: #ffffff;
      line-height: 86px;
      letter-spacing: 20px;
      text-align: center;
      padding-top: 249px;
    }
  }
  .content-box {
    width: 1180px;
    margin: -165px auto 0;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    .item-box {
      width: 278px;
      // margin-right: 20px;
      border-radius: 4px;
      border: 1px solid #f1f1f1;
      margin-bottom: 20px;
      .top {
        padding-top: 32px;
        background: #ffffff;
        // padding-bottom: 20px;
        .item-img {
          width: 100px;
          height: 100px;
          background-size: cover;
          margin: 0 auto 5px;
        }
        .item-title {
          height: 30px;
          font-size: 20px;
          font-family: PingFangSC-Semibold, PingFang SC;
          font-weight: 600;
          color: #272727;
          line-height: 30px;
          text-align: center;
          margin-bottom: 8px;
        }
        .item-tags {
          font-family: PingFangSC-Regular;
          font-size: 12px;
          color: #696969;
          letter-spacing: 0;
          line-height: 18px;
          margin: 8px 33px 0;
          display: flex;
          flex-wrap: wrap;
          justify-content: center;
          .tag {
            margin-right: 5px;
            margin-bottom: 5px;
            padding: 4px;
            border-radius: 3px;
            background: #f9f9f9;
          }
        }
        .item-subtitle {
          width: 100%;
          height: 40px;
          padding: 0 20px;
          box-sizing: border-box;
          font-size: 14px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 500;
          color: #272727;
          line-height: 20px;
          text-align: center;
        }
      }
      .bottom {
        width: 100%;
        height: 86px;
        background: #f9f9f9;
        border-radius: 0px 0px 4px 4px;
        border: 1px solid #f1f1f1;
        box-sizing: border-box;
        padding: 16px 20px;
        font-size: 12px;
        margin-top: 20px;
        font-weight: 400;
        color: #696969;
        line-height: 18px;
        .text {
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 3;
          overflow: hidden;
          word-break: break-all;
        }
      }
    }
  }
  .more-btn {
    width: 200px;
    height: 48px;
    background: #ffffff;
    border-radius: 4px;
    border: 1px solid #d8d8d8;
    margin: 32px auto 0;
    font-size: 16px;

    font-weight: 400;
    color: #4c4c4c;
    text-align: center;
    line-height: 48px;
    cursor: pointer;
    &:active {
      opacity: 0.8;
    }
  }
  .nodata {
    width: 100%;
    text-align: center;
    margin: 60px 0 40px;
    color: #c0c4cc;
  }
}
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}
</style>
